1. Field of the Invention
The present invention relates to a non-volatile memory. More particularly, the present invention relates to a program function of a non-volatile memory.
2. Description of the Related Art
Non-volatile memories can retain data in the absence of power supply. This is an advantage over volatile memories. However, operation of non-volatile memories is more complex than that of volatile memories. For example, in a program operation, the data bits of a non-volatile memory can be changed from one to zero but cannot be changed from zero to one. Therefore, before programming a non-empty sector of a non-volatile memory, an erase operation is required to reset all bits of the non-empty sector to one.
Usually, a conventional non-volatile memory can handle a write request whose data size is as small as one page as program unit, for example, 512 bytes. By contrast, a sector is the minimum erase unit of a non-volatile memory. The size of a sector ranges from 32K bytes or more, i.e. the erase unit is greater or equal to the program unit. The program unit usually has the same size with a buffer. In order to increase the write speed, the write unit tends to become bigger. However, the write unit will still be kept smaller than or equal to the erase unit in the future. If the size of the user data to be programmed into a non-volatile memory does not completely align with  the sector boundary, the original data of the sector have to be read out first and be programmed back into the sector along with the user data in order to preserve the original data in the sector.
The program function of a conventional non-volatile memory does not check whether the target sector is empty or not. The program function of a conventional non-volatile memory does not check whether the size of the user data aligns with the sector boundary or not. Because of the aforementioned reasons, conventional non-volatile memories need external flow control to implement proper and safe operations.